"""
URL configuration for day2 project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib.admindocs import views
from django.urls import path, re_path
# 内部处理
from django.views.static import serve

from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from rest_framework import permissions

from day2 import settings
from wepapi.views import depart, userIn, pretty, admin, account, task, order, chart, upload, city, ws

schema_view = get_schema_view(
    openapi.Info(
        title="1",
        default_version='v1',
        description="API for your project",
        terms_of_service="https://www.google.com/policies/terms/",
        contact=openapi.Contact(email="contact@yourproject.local"),
        license=openapi.License(name="BSD License"),
    ),
    public=True,
    permission_classes=(permissions.AllowAny,),
)

urlpatterns = [



    path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
    path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
    # path('admin/', admin.site.urls),
    # path('', views.index, name='index'),

    re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}, name='media'),
    # """部门管理"""
    path('depart/list/', depart.depart_list, name='depart_list'),
    path('depart/add/', depart.depart_add, name='depart_add'),
    path('depart/del/', depart.depart_del, name='depart_del'),
    path('depart/<int:id>/edit/', depart.depart_edit, name='depart_edit'),

    # """用户管理"""
    path('user/list/', userIn.user_list, name='user_list'),
    path('user/add/', userIn.user_add, name='user_add'),
    path('user/model/form/add/', userIn.user_model_form_add, name='user_model_form_add'),
    path('user/<int:id>/del/', userIn.user_del, name='user_del'),
    path('user/<int:id>/edit/', userIn.user_edit, name='user_edit'),

    #  websocket 测试
    path('ws/index/', ws.adindex, name='adindex'),
    # path('', ws.adindex, name='adindex'),


    # """靓号管理"""
    path('pretty/list/', pretty.pretty_list, name='pretty_list'),
    path('pretty/add/', pretty.pretty_add, name='pretty_add'),
    path('pretty/<int:id>/edit/', pretty.pretty_edit, name='pretty_edit'),
    path('pretty/<int:id>/del/', pretty.pretty_del, name='pretty_del'),

    # """管理员管理"""
    path('admin/list/', admin.admin_list, name='admin_list'),
    path('admin/add/', admin.admin_add, name='admin_add'),
    path('admin/<int:id>/edit/', admin.admin_edit, name='admin_edit'),
    path('admin/<int:id>/del/', admin.admin_del, name='admin_del'),
    path('admin/<int:id>/reset/', admin.admin_reset, name='admin_reset'),
    # """登录和注销"""
    path('account/login/', account.account_login, name='account_login'),
    path('account/logout/', account.account_logout, name='account_logout'),
    path('account/img/', account.account_img, name='account_img'),

    # """任务列表"""
    path('task/list/', task.task_list, name='task_list'),
    path('task/ajax/', task.task_ajax, name='task_ajax'),
    path('task/add/', task.task_add, name='task_add'),

    # """工单管理"""
    path('order/list/', order.order_list, name='order_list'),
    path('order/add/', order.order_add, name='order_add'),
    path('order/del/', order.order_del, name='order_del'),
    path('order/details/', order.order_details, name='order_details'),
    path('order/edit/', order.order_edit, name='order_edit'),

    # """ 数据统计"""
    path('chart/list/', chart.chart_list, name='chart_list'),
    path('chart/bar/', chart.chart_bar, name='chart_bar'),
    path('chart/pie/', chart.chart_pie, name='chart_pie'),
    path('chart/line/', chart.chart_line, name='chart_line'),
    # path('chart/highcharts/', chart.highcharts, name='highcharts'),

    # """上传文件"""
    path('upload/list/', upload.upload_list, name='upload_list'),
    path('upload/form/', upload.upload_form, name='upload_form'),
    path('upload/modal/form/', upload.upload_modal_form, name='upload_modal_form'),
    path('depart/multipart/', depart.depart_multipart, name='depart_multipart'),

    # ""“城市列表“””
    path('city/list/', city.city_list, name='city_list'),
    path('city/add/', city.city_add, name='city_add'),

    # path('user/login/', views.user_login, name='user_login'),
    # path('user/register/', views.user_register, name='user_register'),
]
